<?php $this->fetch('public/head'); ?>
<div class="layui-tab layui-tab-brief">
    <ul class="layui-tab-title">
        <li class=""><a href="<?php echo url('hsmenu/index') ?>">后台菜单</a></li>
        <li class="<?php echo $admin_menu['id']?'':'layui-this' ?>"><a href="<?php echo url('hsmenu/edit') ?>">添加菜单</a></li>
        <?php if($admin_menu['id']>0): ?><li class="layui-this">编辑菜单</li><?php endif; ?>
    </ul>
    <div class="layui-tab-content">
        <div class="layui-tab-item layui-show">
            <form class="layui-form form-container" action="<?php echo url('hsmenu/save') ?>" method="post">
                <div class="layui-form-item">
                    <label class="layui-form-label">上级菜单</label>
                    <div class="layui-input-block">
                        <select name="pid" lay-verify="required">
                            <option value="0">一级菜单</option>
                            <?php foreach($admin_menu_level_list as $v): ?>
                            <option value="<?php echo $v['id'] ?>" <?php if($admin_menu['id']==$v['id']){echo 'disabled="disabled"';} ?><?php if($admin_menu['pid']==$v['id'] || $pid==$v['id']){echo 'selected';} ?>><?php if($v['level']!=1){for($i=1;$i<$v['level'];$i++){echo '----';}}echo $v['title']; ?></option>
                            <?php endforeach; ?>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">菜单名称</label>
                    <div class="layui-input-block">
                        <input type="text" name="title" value="<?php echo $admin_menu['title'] ?>" required  lay-verify="required" placeholder="请输入菜单名称" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">控制器方法</label>
                    <div class="layui-input-block">
                        <input type="text" name="name" value="<?php echo $admin_menu['name'] ?>" placeholder="请输入控制器方法 如：index/index" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">图标</label>
                    <div class="layui-input-block">
                        <input type="text" name="icon" value="<?php echo $admin_menu['icon'] ?>" placeholder="（选填）如：layui-icon-app" class="layui-input">
                        <a target="_blank" href="http://www.layui.com/doc/element/icon.html#table"><u>如何选择图标?</u></a>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">状态</label>
                    <div class="layui-input-block">
                        <input type="radio" name="status" value="1" title="显示" <?php if($admin_menu['status']==1 || !$admin_menu['id']){echo 'checked="checked"';} ?>>
                        <input type="radio" name="status" value="0" title="隐藏" <?php if($admin_menu['status']===0){echo 'checked="checked"';} ?>>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">排序</label>
                    <div class="layui-input-block">
                        <input type="text" name="sort" value="<?php echo $admin_menu['sort']?:'0' ?>" required  lay-verify="required|number" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <input type="hidden" name="id" value="<?php echo $admin_menu['id'] ?>">
                        <button class="layui-btn" lay-submit lay-filter="*">保存</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<?php $this->fetch('public/script'); ?>